-
Notifications
You must be signed in to change notification settings - Fork 218
Check for missing options / databaseURL on emulator start #1016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for missing options / databaseURL on emulator start #1016
Conversation
taeold
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your great contribution!
Can you add an entry in the CHANGELOG to describe the bug fix?
taeold
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more change and we should 🚢
Co-authored-by: Daniel Lee <taeold@gmail.com>
|
No problem. |
|
@Hoppi164 It looks like the linter is failing - can you run |
|
Hi @taeold I've run format:fix and removed the extra spacing i had on the (note: there was a few other lint warnings in unrelated files, i've not corrected these as it seems out-of-scope for this PR) |
|
lgtm - thank you for your contribution (and your patience!) |
|
No problem at all! |
Description
Bug Fix
When using firebase emulators Realtime Database throws an error due to app.options not existing.
I've found adding an extra check to the database constructor stops this error, and results in the emulator starting up correctly.
Code sample
Instead of
if (app && app.options.databaseURL.startsWith('http:'))I've added
if ( app && app.options && app.options.databaseURL && app.options.databaseURL.startsWith('http:') )Note: I've deliberately not used the modern ES6 optional chaining.
This syntax would be much cleaner, but is not supported by your lowest node version.
app?.options?.databaseURL?.startsWith('http:')